package com.zhanglinwei.openApiClient.model.response;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.BooleanUtils;

import java.io.Serializable;

@Getter
@Setter
public abstract class OpenApiResponse implements Serializable {

    private static final long serialVersionUID = -3279367107377505179L;

    private final static String SUCCESS_CODE = "200";

    private String requestId;
    private String code;
    private String msg;
    private Boolean success;
    private Long pageOn;
    private Long pageSize;
    private Long total;


    public static Boolean callSuccess(OpenApiResponse response) {
        return response != null && SUCCESS_CODE.equals(response.getCode()) && BooleanUtils.isTrue(response.getSuccess());
    }

}
